package day19;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

public class CustomLineNumberReaderDemo {

	public static void main(String[] args) {
		CustomLineNumberReader clnr = null;
		try {
			clnr = new CustomLineNumberReader(new FileReader(
					"D:\\MyProject\\javatest\\src\\day19\\BufferedReaderDemo.java"));
			String line = null;
			clnr.setLineNumber(100);
			while ((line = clnr.readLine()) != null) {
				System.out.println(clnr.getLineNumber() + "||"+line);
			}
		} catch (FileNotFoundException e) {
			throw new RuntimeException("系统中文件未找到！");
		} catch (IOException e) {
			throw new RuntimeException("文件读取失败！");
		} finally {
			if (null != clnr) {
				try {
					clnr.close();
				} catch (IOException e) {
					throw new RuntimeException("自定义行号缓冲流关闭失败！");
				}
			}
		}
	}
}
